<template>
  <router-view v-slot="{ Component }">
    <keep-alive>
      <component
        :is="Component"
        v-if="$route.meta.keepAlive"
        :key="$route.path"
      />
    </keep-alive>
  </router-view>
  <router-view v-slot="{ Component }">
    <component
      :is="Component"
      v-if="!$route.meta.keepAlive"
      :key="$route.path"
    />
  </router-view>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import { useRoute } from 'vue-router'

export default defineComponent({
  name: 'App',
  setup() {
    const $route = useRoute()
    return {
      $route
    }
  }
})
</script>

<style lang="scss">
@import '@/styles/public.scss';
</style>
